home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / editor / auror300.zip / MOUSE.AML < prev    next >
Text File  |  1996-07-17  |  5KB  |  230 lines

  1. //--------------------------------------------------------------------
  2. // The Aurora Editor v3.0, Copyright (C) 1993-1996 nuText Systems
  3. //
  4. // MOUSE.AML
  5. // Mouse definitions (included by Main.aml)
  6. //
  7. // If you have made any changes, save this file and select 'Recompile
  8. // the Editor' <alt f2> from the Set menu. Exit and re-enter the
  9. // editor for your changes to take effect.
  10. //--------------------------------------------------------------------
  11.  
  12. //--------------------------------------------------------------------
  13. // Edit and File Manager windows
  14. //--------------------------------------------------------------------
  15.  
  16. object edit_fmgr
  17.  
  18.   // left button down
  19.   event <lbutton>
  20.     if button? 2 then
  21.       queue <chord>
  22.     else
  23.       pass
  24.     end
  25.   end
  26.  
  27.   // right button down
  28.   event <rbutton>
  29.     if button? 1 then
  30.       queue <chord>
  31.     else
  32.       case getregion
  33.         when 1
  34.           gotomenu
  35.         when 11, 12
  36.           open "*.*"
  37.         otherwise
  38.           pass
  39.       end
  40.     end
  41.   end
  42.  
  43.   // left & right button down (mouse chording)
  44.   //event <chord>
  45.   //end
  46.  
  47.   // left button double-click
  48.   event <ldouble>
  49.     case getregion
  50.       // background
  51.       when ''
  52.         winlist
  53.       otherwise
  54.         pass
  55.     end
  56.   end
  57.  
  58. //--------------------------------------------------------------------
  59. // Prompts and Edit windows
  60. //--------------------------------------------------------------------
  61.  
  62. object prompt
  63.  
  64.   public variable lbf
  65.  
  66.   // left button down
  67.   event <lbutton>
  68.     // pass on to the library (Lib.x)
  69.     pass
  70.     // library may switch windows, so check...
  71.     if wintype? "prompt" then
  72.       lbf = ''
  73.       case getregion
  74.         // retrieve tab
  75.         when 14
  76.           askhistory
  77.         // left title
  78.         when 13
  79.           call <lbuttonup>
  80.           close
  81.         // client area
  82.         when 1
  83.           // set flag for mouse marking
  84.           lbf = 1
  85.           trackmouse
  86.           // check for hex view
  87.           if windowflag "h?" then
  88.             hexcol = getmousex - (getcoord 'l1d') - getviewcols - 1
  89.             windowflag "-12"
  90.             if hexcol > 0 then
  91.               windowflag '+1'
  92.             end
  93.           end
  94.       end
  95.     end
  96.   end
  97.  
  98.   // move mouse
  99.   event <move>
  100.     if lbf then
  101.  
  102.       // mouse marking
  103.       if lbf == 1 then
  104.         destroymark
  105.  
  106.         mark_type = if? (wintype? "edit") (shiftkey? 0Fh) 1h
  107.  
  108.         // get the mark type from the keyboard shift-state or the
  109.         // MouMark config variable
  110.         if not mark_type then
  111.           mark_type = case _MouMark
  112.                         when 'k'  4h
  113.                         when 'l'  8h
  114.                         otherwise 1h
  115.                       end
  116.         end
  117.  
  118.         case mark_type
  119.           when 4h    markcolumn
  120.           when 8h    markline
  121.           otherwise  markstream
  122.         end
  123.         lbf = 2
  124.       end
  125.       trackmouse
  126.     else
  127.       pass
  128.     end
  129.   end
  130.  
  131.   // left button up
  132.   event <lbuttonup>
  133.     if lbf then
  134.       stopmark
  135.       lbf = ''
  136.     end
  137.     pass
  138.   end
  139.  
  140.  
  141. //--------------------------------------------------------------------
  142. // Edit windows
  143. //--------------------------------------------------------------------
  144.  
  145. object edit
  146.  
  147.   // left button double-click
  148.   event <ldouble>
  149.     case getregion
  150.       when 1
  151.         destroymark
  152.         case _MouMarkD
  153.           when 'k'   markcolumn
  154.           when 's'   markstream
  155.           otherwise  markline
  156.         end
  157.         prompt.lbf = 2
  158.       otherwise
  159.         pass
  160.     end
  161.   end
  162.  
  163.   // left button triple-click
  164.   event <ltriple>
  165.     case getregion
  166.       when 1
  167.         markword
  168.     end
  169.   end
  170.  
  171. //--------------------------------------------------------------------
  172. // File Manager windows
  173. //--------------------------------------------------------------------
  174.  
  175. object fmgr
  176.  
  177.   variable lbf, lasty
  178.  
  179.   // double click to open
  180.   event <ldouble>
  181.     lbf = ''
  182.     case getregion
  183.       when 1
  184.         //fopen '1'
  185.         send <enter>
  186.       otherwise
  187.         pass
  188.     end
  189.   end
  190.  
  191.   // left button down
  192.   event <lbutton>
  193.     // pass on to the library (Lib.x)
  194.     pass
  195.     // library may switch windows, so check...
  196.     if wintype? "fmgr" then
  197.       if getregion == 1 then
  198.         lbf = 1
  199.         trackmouse
  200.         // toggle file mark if <ctrl> is pressed
  201.         if shiftkey? 4h then
  202.           fmark
  203.         end
  204.       else
  205.         lbf = ''
  206.       end
  207.     end
  208.   end
  209.  
  210.   // mouse move
  211.   event <move>
  212.     y = getmousey 'e'
  213.     if lbf and (button? 1h) then
  214.       if shiftkey? and y <> lasty then
  215.         fmark
  216.       end
  217.       lasty = y
  218.       trackmouse
  219.     else
  220.       lbf = ''
  221.       pass
  222.     end
  223.   end
  224.  
  225.   // left button up
  226.   event <lbuttonup>
  227.     lbf = ''
  228.     pass
  229.   end
  230.